package com.bz.controller;

import com.bz.entity.User;
import com.bz.service.Userservice;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {


    @Resource
    Userservice userservice;

    @RequestMapping("/save")
    public String save(){
        System.out.println("controlller+ save");
        User u = new User(33,"bajie","111111","11111111111","huaguos");
        userservice.save(u);
        return "success";
    }


    @RequestMapping("/findAll")
    @ResponseBody
    public String findAll(){
        System.out.println("controlller+ findAll");
        List<User> all = userservice.findAll();
        return all.toString();
    }
}
